﻿ @{
    ViewBag.Title = "Hóa đơn đã thanh toán";
    Layout = "~/Views/Shared/_Admin_Layout.cshtml";
    ViewBag.Controller = "orders";
    ViewBag.Cate = "Hóa đơn đã thanh toán";
    
    var Order = "asc";

    if (Request.QueryString["sort_type"] == "asc")
    {
        Order = "desc";
    }else{
        Order = "asc";
    }
}

<script type="text/javascript">
    $(function () {
        var $hash = window.location.hash;
        var $strHash = $hash.split("=");
        var $numPage = $strHash[1];
        var $keyword = $("#_search").val();
        if ($numPage == undefined) $numPage = 1;

        //Load Content Purchased
        $('#content-loading').fadeIn(300);
        $.post('/admin/@ViewBag.Controller/LoadContentPurchased', { page: $numPage, sort_by: "@Request.QueryString["sort_by"]", sort_type: "@Request.QueryString["sort_type"]", keyword: $keyword }, function (data) {
            $('#_loadContentPurchased').html(data);
            altRows('alternatecolor');
            $('#content-loading').fadeOut(300);
        });

        $(".order-product").live("click", function () {
            var oid = $(this).data("id");
            $(".detail-order").slideUp(0, function () {
                $(".detail-order").remove();
            });

            $(this).parents("tr").after('<tr class="detail-order"><td colspan="8"></td></tr>');
            //altRows('alternatecolor');

            $.post(
                '/admin/@ViewBag.Controller/detail',
                { oid: oid },
                function (data) {
                    $(".detail-order td").html(data);
                    //alert("thành cong");
                    $(".detail-order").slideDown(200);

                    var offset_order = parseInt($('.detail-order').offset().top);
                    $('body').stop().animate({ scrollTop: offset_order - 30 }, 500);

                }
            );
        });
    });
</script>

<!--Tabs-->
<div class="tabs">
    <span class="item"><a href="/admin" title="">Bảng điều khiển</a></span>
    <span class="icon-arrow">&gt;</span>
    <span class="item">@ViewBag.Cate</span>
</div>
<!--End Tabs-->

<!--Container-->
<div class="container">
    <form class="table-data" method="post">
        <div class="list-btn">
            <input type="text" id="_search" name="name" value="" placeholder="Tìm kiếm" />
            <a href="/admin/@ViewBag.Controller/update" class="btn btn-success" title="Thêm">Thêm</a>
            <input type="submit" name="delete" id="_btn_del" class="btn btn-danger" value="Xóa" />
        </div>
        <div class="clearAll"></div>
        <div class="notice"><span class="close-notice icon-remove"></span></div>
		<div class="title"><span class="icon-list-alt"></span>@ViewBag.Cate<span id="content-loading"></span></div>
		<div class="error"></div>
		<div class="box-field">
            <table class="altrowstable" id="alternatecolor">
                <thead>
                <tr>
                    <th class="cbox"><input type="checkbox" id="CheckAll" /></th>   
                    <th><a class="fullname" href="/admin/@ViewBag.Controller?sort_by=name&sort_type=@Order" title="Tên sản phẩm">Họ tên</a></th>
                    <th><a class="phone" href="/admin/@ViewBag.Controller?sort_by=code&sort_type=@Order" title="Số điện thoại">Số điện thoại</a></th>
                    <th><a class="email" href="/admin/@ViewBag.Controller?sort_by=code&sort_type=@Order" title="Email">Email</a></th>
                    <th><a class="message" href="/admin/@ViewBag.Controller?sort_by=code&sort_type=@Order" title="Message">Message</a></th>
                    <th><a class="status" href="/admin/@ViewBag.Controller?sort_by=status&sort_type=@Order" title="Status">Status</a></th>
                    <th><a class="created" href="/admin/@ViewBag.Controller?sort_by=created&sort_type=@Order" title="Ngày mua">Ngày mua</a></th>
                    <th>Chi tiết</th>
                </tr>
                </thead>
                <tbody id="_loadContentPurchased">
                    <!--Dữ Liệu Load AJAX Ở Đây-->
                </tbody>
                <tr>
                    <td colspan="8"  style="text-align: center;">
						<div class="pagination"></div>
                    </td>
                </tr>
            </table>
		</div>
	</form>
</div>
<!--End Container-->